package com.amado.course13;

import java.util.Scanner;

/**
 * 样例
 * 
 * @author Administrator
 *
 */
public class VariateFour {
	static VariateThreeStudent[] studentArray = new VariateThreeStudent[100];
	static int studentCount = 0;
	static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			System.out.println("1、添加  2、查询 3、退出");
			int menuSelect = scanner.nextInt();
			if (menuSelect == 1) {
				add();
			}else if (menuSelect == 2) {
				print();
			}else if (menuSelect == 3){
				break;
			}
		}
	}

	public static void add() {
		System.out.println("输入你的姓名");
		String name = scanner.next();
		System.out.println("输入你的性别");
		int sex = scanner.nextInt();
		VariateThreeStudent student = new VariateThreeStudent();
		student.name = name;
		student.sex = sex;
		studentArray[studentCount++] = student;
	}

	public static void print() {
		System.out.println("姓名\t性别");
		for (int i=0;i<studentCount;i++) {
			System.out.println(studentArray[i].name + "\t" + studentArray[i].sex);
			System.out.printf("%s\t%s\n",studentArray[i].name,studentArray[i].sex);
		}
	}
}
